{# version, hostname, uptime, loadavg, #}

{% extends "layout.html" %}

{% block title %} {{ _('Dashboard') }} {% endblock %}
{% block navlinks_active_dashboard %}class="active"{% endblock %}

{% block main %}

<div class="columns clear">
    <div class="col1-3">
        <h2>{{ _('System Information') }}</h2>
        <div class="box-wrap clear">
            <table class="basic" cellspacing="0">
                <tbody>

                    <tr>
                        <th>iRedAdmin</th>
                        <td>v{{ version }}
                            {% if backend == 'mysql' %}
                                (MySQL)
                            {% elif backend == 'mysql' %}
                                (LDAP)
                            {% endif %}

                            {% if newVersionInfo[0] is sameas none %}
                                {# Already checked today. #}
                                &nbsp;
                            {% elif newVersionInfo[0] is sameas true %}
                                {# New version available #}
                                {% if newVersionInfo[1].version > version %}
                                    <strong>{{ _("Update available: <a href='%s' target='_blank'>v%s</a>.") |format(newVersionInfo[1].url, newVersionInfo[0].version,) }}</strong>
                                {% endif %}
                            {% else %}
                                {# Error while checking #}
                                <strong class="red">{{ _('Error while checking new version: %s') |format(newVersionInfo[1]) }}</strong>
                            {% endif %}
                        </td>
                    </tr>

                    {# ---- System Information ---- #}
                    <tr>
                        <th>{{ _('Hostname') }}</th>
                        <td>{{ hostname }}</td>
                    </tr>

                    {% if uptime is not sameas none and uptime|length == 3 %}
                    <tr>
                        <th>{{ _('Uptime') }}</th>
                        <td>{{ _('%s days, %s hours, %s minutes.') |format(uptime[0], uptime[1], uptime[2]) }}</td>
                    </tr>
                    {% endif %}

                    <tr>
                        <th>{{ _('Server load') }}</th>
                        <td>{{ '%s, %s, %s.' |format(loadavg[0], loadavg[1], loadavg[2]) }}</td>
                    </tr>

                    {# ---- Network interfaces and IP info ---- #}
                    {% for netif in netif_data.items() %}
                        {% if netif[0] != 'lo' %}
                        <tr>
                            <th>{{ _('Network') }} ({{ netif[0] }})</th>
                            <td>{{ netif[1]['addr'] }}<span class="grey">/{{ netif[1]['netmask'] }}</span></td>
                        </tr>
                        {% endif %}
                    {% endfor %}
                </tbody>
            </table>
        </div><!-- .box-wrap -->
    </div><!-- .col1-3 -->

    <div class="col2-4">
        <h2><a href="http://www.iredmail.org/admin_panel.html">Purchase iRedAdmin-Pro to get more features</a></h2>
        <div class="box-wrap clear">
            <ul class="standard clean-padding bt-space10">
                <li>Unlimited number of mail lists/aliases</li>
                <li>Policyd integration: blacklist, whitelist</li>
                <li>Amavisd integration:
                    <ul class="standard clean-padding bt-space10">
                        <li>view log of received and sent mail</li>
                        <li>Quarantine and manage SPAM mails</li>
                    </ul>
                </li>
                <li>Per-user real-time quota usage report</li>
                <li>Alias domain support</li>
                <li>Per-domain bcc, relay, catch-all, account limit control</li>
                <li>Per-domain and per-user service restrictions</li>
            </ul>
        </div>
    </div><!-- .col2-4 -->
</div><!-- .columns -->

{% endblock main %}

{% block js %}
    {{ load_jquery(['tablesorter'], sortFirstCol=false) }}
{% endblock js %}
